package addon.w3.mdx.com;

import java.io.IOException;

import addon.w3.mdx.MDXCOM;
import addon.w3.mdx.LEDataInputStream;
import addon.w3.mdx.MDXException;

/**
--MTGC						// [Groups]
	long	nmtrcs;				//   GroupCount is an array of lengths
	long	groupCount[nmtrcs];		//   for each group.
 * @author madjk
 *
 */
public class MDXGroupsCOM extends MDXCOM {
	int length = -1;
	public int groupCount[] = null;
	
	public String getTag() {
		return "MTGC";
	}
	
	public void _decode(LEDataInputStream ins) throws IOException, MDXException {
		length = ins.readInt();
		groupCount = new int[length];
		for (int i = 0; i < groupCount.length; i++) {
			groupCount[i] = ins.readInt();
		}
	}
	
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("TAG : "+getTag());
		sb.append("\n\tILEN : "+length);
		if(groupCount != null && groupCount.length > 0) sb.append("\n\tGROUPS[] : "+groupCount.length);
		return sb.toString();
	}

	@Override
	public boolean isImplicitTag() {
		// TODO Auto-generated method stub
		return true;
	}
}
